﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmetic.DataEntity;
using System.Collections;

namespace Cosmetic.Logic
{
    public class AdvertiseManager : LogicBase
    {

        /// <summary>
        /// 左上角广告
        /// </summary>
        /// <returns></returns>
        public IndexAd01 GetIndexAd01()
        {
            return m_CosmeticDC.IndexAd01s.First();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="PicUrl"></param>
        /// <param name="Url"></param>
        public void UpdateIndexAd01(string PicUrl, string Url)
        {
            IndexAd01 inad01 = m_CosmeticDC.IndexAd01s.First();
            inad01.PicUrl = PicUrl;
            inad01.Url = Url;

            m_CosmeticDC.SubmitChanges();
        }

        /// <summary>
        /// 左二广告
        /// </summary>
        /// <returns></returns>
        public IndexAd02 GetIndexAd02()
        {
            return m_CosmeticDC.IndexAd02s.First();
        }

        public void UpdateIndexAd02(string PicUrl, string Url)
        {
            IndexAd02 inad02 = m_CosmeticDC.IndexAd02s.First();
            inad02.PicUrl = PicUrl;
            inad02.Url = Url;
            m_CosmeticDC.SubmitChanges();
        }
        /// <summary>
        /// 左三广告
        /// </summary>
        /// <returns></returns>
        public IndexAd03 GetIndexAd03()
        {
            return m_CosmeticDC.IndexAd03s.First();
        }

        public void UpdateIndexAd03(string PicUrl, string Url)
        {
            IndexAd03 inad03 = m_CosmeticDC.IndexAd03s.First();
            inad03.PicUrl = PicUrl;
            inad03.Url = Url;
            m_CosmeticDC.SubmitChanges();
        }
        /// <summary>
        /// 电子目录
        /// </summary>
        /// <param name="aEmail"></param>
        /// <param name="aUserId"></param>
        public void NewSubScribe(string aEmail, string aUserId)
        {
            try
            {
                ElecSubscribe es = new ElecSubscribe();
                es.Id = Guid.NewGuid();
                es.CreateTime = DateTime.Now;
                es.Email = aEmail;
                if (aUserId != "")
                {
                    es.UserId = new Guid(aUserId);
                }

                this.m_CosmeticDC.ElecSubscribes.InsertOnSubmit(es);
                this.m_CosmeticDC.SubmitChanges();
            }
            catch (Exception)
            {

                throw;
            }
        }

        public IEnumerable GetSubScribe()
        {
            var result = (from es in m_CosmeticDC.ElecSubscribes
                          where 1 == 1
                          orderby es.CreateTime descending
                          select new
                          {
                              Email = es.Email,
                              CreateTime = es.CreateTime,
                              IsRegistered = es.UserId == null ? false : true
                          }
                          ).ToList();
            return result;
        }

        /// <summary>
        /// ibeauty特辑
        /// </summary>
        /// <returns></returns>
        public List<IbeautyReferenceIssue> GetIbeautyReferenceIssue()
        {
            var result = (from theIssue in m_CosmeticDC.IbeautyReferenceIssues
                          orderby theIssue.Sequence ascending
                          select theIssue).ToList();
            return result;
        }

        public IbeautyReferenceIssue GetIbeautyReferById(int Id)
        {
            var result = (from theIssue in m_CosmeticDC.IbeautyReferenceIssues
                          where theIssue.Id == Id
                          select theIssue).Single();
            return result;
        }

        public void UpdateIbeautyReferenceIssue(int Id, string PicUrl, string Url)
        {
            var result = (from theIssue in m_CosmeticDC.IbeautyReferenceIssues
                          where theIssue.Id == Id
                          select theIssue).Single();
            result.PicUrl = PicUrl;
            result.Url = Url;
            m_CosmeticDC.SubmitChanges();
        }

        public void DeleteIbeautyReferenceIssueById(int Id)
        {
            var result = (from theIssue in m_CosmeticDC.IbeautyReferenceIssues
                          where theIssue.Id == Id
                          select theIssue).Single();
            this.m_CosmeticDC.IbeautyReferenceIssues.DeleteOnSubmit(result);
            this.m_CosmeticDC.SubmitChanges();
        }

        public void UpdateIbeautyReferenceIssueSequence(int Id, string Sequence)
        {
            var result = (from theIssue in m_CosmeticDC.IbeautyReferenceIssues
                          where theIssue.Id == Id
                          select theIssue).Single();
            result.Sequence = int.Parse(Sequence);

            m_CosmeticDC.SubmitChanges();
        }

        public void CreateIbeautyReferenceIssue(string PicUrl, string Url)
        {
            IbeautyReferenceIssue newIb = new IbeautyReferenceIssue();
            newIb.PicUrl = PicUrl;
            newIb.Url = Url;

            var result = (from dd in m_CosmeticDC.IbeautyReferenceIssues
                          orderby dd.Sequence descending
                          where 1 == 1
                          select dd).First();
            newIb.Sequence = result.Sequence + 1;

            m_CosmeticDC.IbeautyReferenceIssues.InsertOnSubmit(newIb);

            m_CosmeticDC.SubmitChanges();
        }

        /// <summary>
        /// 底部广告230 X 250
        /// </summary>
        /// <returns></returns>
        public List<BottomAd> GetBottomAd()
        {
            var result = (from bottom in m_CosmeticDC.BottomAds
                          select bottom).ToList();
            return result;
        }

        public void SaveBottomAd(int Id, string PicUrl, string Url)
        {
            var result = (from bottom in m_CosmeticDC.BottomAds
                          where bottom.Id == Id
                          select bottom).Single();
            result.PicUrl = PicUrl;
            result.Url = Url;

            m_CosmeticDC.SubmitChanges();

        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<SpecialRegular> GetSpecialRegulars()
        {
            var result = (from theSpec in m_CosmeticDC.SpecialRegulars
                          orderby theSpec.Sequence ascending
                          select theSpec).ToList();
            return result;
        }

        public void SaveSpecialRegular(int Id, string PicUrl, string Url)
        {
            var result = (from theSpecialRegular in m_CosmeticDC.SpecialRegulars
                          where theSpecialRegular.Id == Id
                          select theSpecialRegular).Single();
            result.PicUrl = PicUrl;
            result.Url = Url;

            m_CosmeticDC.SubmitChanges();
        }

        public void SavePlateClothPositionRule(bool IsLeftPic, bool IsRightPic)
        {
            PlateExcellentClothBigPic pjc = m_CosmeticDC.PlateExcellentClothBigPics.First();
            pjc.IsLeftPositionPic = IsLeftPic;
            pjc.IsRightPositionPic = IsRightPic;
            m_CosmeticDC.SubmitChanges();
        }

        public void SavePlateHouseHoldPositionRule(bool IsLeftPic, bool IsRightPic)
        {
            PlateHouseHoldBigPic pjc = m_CosmeticDC.PlateHouseHoldBigPics.First();
            pjc.IsLeftPositionPic = IsLeftPic;
            pjc.IsRightPositionPic = IsRightPic;
            m_CosmeticDC.SubmitChanges();
        }

        public void SavePlateCosmeticPositionRule(bool IsLeftPic, bool IsRightPic)
        {
            PlateJapaneseCosmeticBigPic pjc = m_CosmeticDC.PlateJapaneseCosmeticBigPics.First();
            pjc.IsLeftPositionPic = IsLeftPic;
            pjc.IsRightPositionPic = IsRightPic;
            m_CosmeticDC.SubmitChanges();
        }

        public PlateExcellentClothBigPic GetPlateClothBigPic()
        {
            return m_CosmeticDC.PlateExcellentClothBigPics.First();
        }

        public PlateHouseHoldBigPic GetPlateHouseHoldBigPic()
        {
            return m_CosmeticDC.PlateHouseHoldBigPics.First();
        }

        public PlateJapaneseCosmeticBigPic GetPlateCosmeticBigPic()
        {
            return m_CosmeticDC.PlateJapaneseCosmeticBigPics.First();
        }

        public void UpdatePlateCosmeticBigPic(string PicUrl, string Url)
        {
            PlateJapaneseCosmeticBigPic pjc = m_CosmeticDC.PlateJapaneseCosmeticBigPics.First();
            pjc.PicUrl = PicUrl;
            pjc.Url = Url;

            m_CosmeticDC.SubmitChanges();
        }

        public void UpdateHouseHoldBigPic(string PicUrl, string Url)
        {
            PlateHouseHoldBigPic pjb = m_CosmeticDC.PlateHouseHoldBigPics.First();
            pjb.PicUrl = PicUrl;
            pjb.Url = Url;
            m_CosmeticDC.SubmitChanges();
        }

        public void UpdateClothBigPic(string PicUrl, string Url)
        {
            PlateExcellentClothBigPic pjc = m_CosmeticDC.PlateExcellentClothBigPics.First();
            pjc.PicUrl = PicUrl;
            pjc.Url = Url;
            m_CosmeticDC.SubmitChanges();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateExcellentClothPlaceHolder> GetPlateClothPlaceHolderLEFT()
        {
            var result = (from cloth in m_CosmeticDC.PlateExcellentClothPlaceHolders
                          orderby cloth.Sequence ascending
                          where cloth.Position == "LEFT"
                          select cloth).ToList();
            return result;
        }

        public void UpdatePlateClothPlaceHolder(int Id, string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            var result = (from cloth in m_CosmeticDC.PlateExcellentClothPlaceHolders
                          where cloth.Id == Id
                          select cloth).Single();
            result.PicUrl = PicUrl;
            result.Link = Link;
            result.LinkAddress = LinkAddress;
            result.Sequence = Sequence;

            m_CosmeticDC.SubmitChanges();
        }

        /// <summary>
        /// insert plageClothPlaceHolder
        /// </summary>
        /// <param name="PicUrl"></param>
        /// <param name="Link"></param>
        /// <param name="LinkAddress"></param>
        /// <param name="Sequence"></param>
        public void InsertPlateClothPlaceHolderTop(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateExcellentClothPlaceHolder newone = new PlateExcellentClothPlaceHolder();
            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.Position = "TOP";

            m_CosmeticDC.PlateExcellentClothPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }
        public void InsertPlateClothPlaceHolderLeft(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateExcellentClothPlaceHolder newone = new PlateExcellentClothPlaceHolder();
            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "LEFT";

            m_CosmeticDC.PlateExcellentClothPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }
        public void InsertPlateClothPlaceHolderRight(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateExcellentClothPlaceHolder newone = new PlateExcellentClothPlaceHolder();
            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "RIGHT";

            m_CosmeticDC.PlateExcellentClothPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }

        public void InsertPlateHouseHoldPlaceHolderTop(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateHouseHoldPlaceHolder newone = new PlateHouseHoldPlaceHolder();
            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "TOP";

            m_CosmeticDC.PlateHouseHoldPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }
        public void InsertPlateHouseHoldPlaceHolderLeft(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateHouseHoldPlaceHolder newone = new PlateHouseHoldPlaceHolder();
            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "LEFT";

            m_CosmeticDC.PlateHouseHoldPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }

        public void InsertPlateHouseHoldPlaceHolderRight(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateHouseHoldPlaceHolder newone = new PlateHouseHoldPlaceHolder();
            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "RIGHT";

            m_CosmeticDC.PlateHouseHoldPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }

        public void InsertPlateHouseHoldPlaceHolder(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateHouseHoldPlaceHolder newone = new PlateHouseHoldPlaceHolder();
            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "RIGHT";

            m_CosmeticDC.PlateHouseHoldPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }


        public void InsertPlateCosmeticPlaceHolderTop(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateJapaneseCosmeticPlaceHolder newone = new PlateJapaneseCosmeticPlaceHolder();

            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "TOP";

            m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }


        public void InsertPlateCosmeticPlaceHolderLeft(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateJapaneseCosmeticPlaceHolder newone = new PlateJapaneseCosmeticPlaceHolder();

            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "LEFT";

            m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }

        public void InsertPlateCosmeticPlaceHolderRight(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateJapaneseCosmeticPlaceHolder newone = new PlateJapaneseCosmeticPlaceHolder();

            newone.PicUrl = PicUrl;
            newone.Link = Link;
            newone.LinkAddress = LinkAddress;
            newone.Sequence = Sequence;
            newone.IsPic = false;
            newone.Position = "RIGHT";

            m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders.InsertOnSubmit(newone);
            m_CosmeticDC.SubmitChanges();
        }

        public void DeletePlateClothPlaceHolder(int Id)
        {
            var result = (from theCloth in m_CosmeticDC.PlateExcellentClothPlaceHolders
                          where theCloth.Id == Id
                          select theCloth).Single();
            m_CosmeticDC.PlateExcellentClothPlaceHolders.DeleteOnSubmit(result);
            m_CosmeticDC.SubmitChanges();
        }

        public void DeletePlateHouseHoldPlaceHolder(int Id)
        {
            var result = (from theHouseHold in m_CosmeticDC.PlateHouseHoldPlaceHolders
                          where theHouseHold.Id == Id
                          select theHouseHold).Single();
            m_CosmeticDC.PlateHouseHoldPlaceHolders.DeleteOnSubmit(result);
            m_CosmeticDC.SubmitChanges();
        }

        public void DeletePlateCosmeticPlaceHolder(int Id)
        {
            var result = (from theCosmetic in m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders
                          where theCosmetic.Id == Id
                          select theCosmetic).Single();

            m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders.DeleteOnSubmit(result);
            m_CosmeticDC.SubmitChanges();
        }

        public void UpdatePlateHouseHoldPlaceHolder(int Id, string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            var result = (from house in m_CosmeticDC.PlateHouseHoldPlaceHolders
                          where house.Id == Id
                          select house).Single();
            result.PicUrl = PicUrl;
            result.Link = Link;
            result.LinkAddress = LinkAddress;
            result.Sequence = Sequence;

            m_CosmeticDC.SubmitChanges();
        }

        public void UpdatePlateCosmeticPlaceHolder(int Id, string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            var result = (from cosmetic in m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders
                          where cosmetic.Id == Id
                          select cosmetic).Single();

            result.PicUrl = PicUrl;
            result.Link = Link;
            result.LinkAddress = LinkAddress;
            result.Sequence = Sequence;

            m_CosmeticDC.SubmitChanges();

        }

        public void InsertPlateClothPicPlaceHolderLEFT(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateExcellentClothPlaceHolder pecph = new PlateExcellentClothPlaceHolder();
            pecph.Link = Link;
            pecph.PicUrl = PicUrl;
            pecph.LinkAddress = LinkAddress;
            pecph.Position = "LEFT";
            pecph.IsPic = true;

            m_CosmeticDC.PlateExcellentClothPlaceHolders.InsertOnSubmit(pecph);
            m_CosmeticDC.SubmitChanges();
        }

        public void InsertPlateCosmeticPlaceHolderLEFT(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            //PlateHouseHoldPlaceHolder phhph = new PlateHouseHoldPlaceHolder();
            PlateJapaneseCosmeticPlaceHolder pjcp = new PlateJapaneseCosmeticPlaceHolder();


            pjcp.Link = Link;
            pjcp.PicUrl = PicUrl;
            pjcp.LinkAddress = LinkAddress;
            pjcp.Position = "LEFT";
            pjcp.IsPic = true;

            m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders.InsertOnSubmit(pjcp);
            m_CosmeticDC.SubmitChanges();

        }

        public void InsertPlateCosmeticPlaceHolderRIGHT(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            //PlateHouseHoldPlaceHolder phhph = new PlateHouseHoldPlaceHolder();
            PlateJapaneseCosmeticPlaceHolder pjcp = new PlateJapaneseCosmeticPlaceHolder();


            pjcp.Link = Link;
            pjcp.PicUrl = PicUrl;
            pjcp.LinkAddress = LinkAddress;
            pjcp.Position = "RIGHT";
            pjcp.IsPic = true;

            m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders.InsertOnSubmit(pjcp);
            m_CosmeticDC.SubmitChanges();

        }



        public void InsertPlateHouseHoldPlaceHolderLEFT(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateHouseHoldPlaceHolder phhph = new PlateHouseHoldPlaceHolder();
            phhph.Link = Link;
            phhph.PicUrl = PicUrl;
            phhph.LinkAddress = LinkAddress;
            phhph.Position = "LEFT";
            phhph.IsPic = true;

            m_CosmeticDC.PlateHouseHoldPlaceHolders.InsertOnSubmit(phhph);
            m_CosmeticDC.SubmitChanges();

        }

        public void InsertPlateHouseHoldPlaceHolderRIGHT(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateHouseHoldPlaceHolder phhph = new PlateHouseHoldPlaceHolder();
            phhph.Link = Link;
            phhph.PicUrl = PicUrl;
            phhph.LinkAddress = LinkAddress;
            phhph.Position = "RIGHT";
            phhph.IsPic = true;

            m_CosmeticDC.PlateHouseHoldPlaceHolders.InsertOnSubmit(phhph);
            m_CosmeticDC.SubmitChanges();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateExcellentClothPlaceHolder> GetPlateClothPlaceHolderRIGHT()
        {
            var result = (from cloth in m_CosmeticDC.PlateExcellentClothPlaceHolders
                          orderby cloth.Sequence ascending
                          where cloth.Position == "RIGHT"
                          select cloth).ToList();
            return result;
        }

        public void InsertPlateClothPicPlaceHolderRIGHT(string PicUrl, string Link, string LinkAddress, int Sequence)
        {
            PlateExcellentClothPlaceHolder pecph = new PlateExcellentClothPlaceHolder();
            pecph.Link = Link;
            pecph.PicUrl = PicUrl;
            pecph.LinkAddress = LinkAddress;
            pecph.Position = "RIGHT";
            pecph.IsPic = true;

            m_CosmeticDC.PlateExcellentClothPlaceHolders.InsertOnSubmit(pecph);
            m_CosmeticDC.SubmitChanges();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateExcellentClothPlaceHolder> GetPlateClothPlaceHolderTOP()
        {
            var result = (from cloth in m_CosmeticDC.PlateExcellentClothPlaceHolders
                          orderby cloth.Sequence ascending
                          where cloth.Position == "TOP"
                          select cloth).ToList();
            return result;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateHouseHoldPlaceHolder> GetPlateHouseHoldPlaceHolderLEFT()
        {
            var result = (from householder in m_CosmeticDC.PlateHouseHoldPlaceHolders
                          orderby householder.Sequence ascending
                          where householder.Position == "LEFT"
                          select householder).ToList();
            return result;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateHouseHoldPlaceHolder> GetPlateHouseHoldPlaceHolderRIGHT()
        {
            var result = (from householder in m_CosmeticDC.PlateHouseHoldPlaceHolders
                          orderby householder.Sequence ascending
                          where householder.Position == "RIGHT"
                          select householder).ToList();
            return result;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateHouseHoldPlaceHolder> GetPlateHouseHoldPlaceHolderTOP()
        {
            var result = (from householder in m_CosmeticDC.PlateHouseHoldPlaceHolders
                          orderby householder.Sequence ascending
                          where householder.Position == "TOP"
                          select householder).ToList();
            return result;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateJapaneseCosmeticPlaceHolder> GetPlateCosmeticPlaceHolderLEFT()
        {
            var result = (from cosmetic in m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders
                          orderby cosmetic.Sequence ascending
                          where cosmetic.Position == "LEFT"
                          select cosmetic).ToList();
            return result;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateJapaneseCosmeticPlaceHolder> GetPlateCosmeticPlaceHolderRIGHT()
        {
            var result = (from cosmetic in m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders
                          orderby cosmetic.Sequence ascending
                          where cosmetic.Position == "RIGHT"
                          select cosmetic).ToList();
            return result;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PlateJapaneseCosmeticPlaceHolder> GetPlateCosmeticPlaceHolderTOP()
        {
            var result = (from cosmetic in m_CosmeticDC.PlateJapaneseCosmeticPlaceHolders
                          orderby cosmetic.Sequence ascending
                          where cosmetic.Position == "TOP"
                          select cosmetic).ToList();
            return result;
        }

        public RecommandProductPic GetRecommandProductPic()
        {
            return m_CosmeticDC.RecommandProductPics.First();
        }

        public void SaveRecommandProductPic(string PicUrl, string Url)
        {
            RecommandProductPic pic = m_CosmeticDC.RecommandProductPics.First();
            pic.PicUrl = PicUrl;
            pic.Url = Url;

            m_CosmeticDC.SubmitChanges();
        }

    }
}
